package com.mercury.pattern._17_mediator;

public class HouseOwner implements Person {
    /**
     * 中介
     */
    Mediator mediator;

    /**
     * 当前用户的名字
     */
    String name;

    public HouseOwner(Mediator mediator, String name) {
        this.mediator = mediator;
        this.name = name;
    }

    /**
     * 向中介发送消息
     * @param msg
     */
    @Override
    public void contact(String msg,Person person) {
        mediator.talk(msg,person);
    }

    /**
     * 获取消息
     * @param recieveMsg
     */
    @Override
    public void getMsg(String recieveMsg) {
        System.out.println(this.name + "接收到消息：" + recieveMsg);
    }
}
